<?php
echo"TYPE: ".$obj->pag_type;
 if(isset($obj->access) && $obj->access['allow'] == true){ $access = $obj->access;?>
<div id="toolbar-box">
    <div class="toolbar" id="toolbar">
	<table class="toolbar">
            <tr>
                                <?php if($access['allow_off'] == true){ ?>
				<td class="button" id="toolbar-publish">
				<a href="#" onclick="setpublish('pub');" class="toolbar">
				<span class="icon-32-publish" title="Publish">
				</span>
				Публікувати
				</a>
				</td>

				<td class="button" id="toolbar-unpublish">
				<a href="#" onclick="setpublish('unpub');" class="toolbar">
				<span class="icon-32-unpublish" title="Unpublish">
				</span>
				Непублікувати
				</a>
				</td>
                                <?php } if($access['allow_delete'] == true){ ?>
				<td class="button" id="toolbar-trash">
				<a href="#" onclick="delet('razdel');" class="toolbar">
				<span class="icon-32-trash" title="Trash">
				</span>
				Видалити
				</a>
				</td>
                                <?php } if($access['allow_edit'] == true){ ?>
				<td class="button" id="toolbar-edit">
				<a href="#" onclick="edit('razdel');" class="toolbar">
				<span class="icon-32-edit" title="Edit">
				</span>
				Редагувати
				</a>
				</td>
                                <?php } if($access['allow_write'] == true){ ?>
				<td class="button" id="toolbar-new">
				<a  href="/admin/add.html?id=<?=$obj->razdel?>" class="toolbar">
				<span class="icon-32-new" title="New">
				</span>
				<?php if(isset($obj->pag_type) && $obj->pag_type==8){echo"Завантажити";}else{echo"Створити";} ?>
				</a>
				</td>
                                <?php } ?>
            </tr>
       </table>
</div>
   <div class="clear"></div>
</div>
<div class="clear"></div>
	<div style="padding-left:20px;"><?php echo $obj->link; ?></div>
<div id="element-box">
			<div class="m">				
				<form action="" method="post" name="adminForm">
				<table class="adminlist">
					<thead>
						<tr>
							<th width="20px">#</th>
							<th width="15px" align="left">
								<input type="checkbox" id="toggle" name="toggle" value="" onclick="CheckAll();" />
							</th>
							<th class="title">Назва</th>
							<th class="title" width="20px"><?php if(isset($obj->pag_type) && $obj->pag_type==8){echo"Превью";}else{echo"Тип";} ?></th>
							<?php if(isset($obj->pag_type) && $obj->pag_type!=8){ ?>
								<th width="5%">Посилання</th>
							<?php }	if($access['allow_edit'] == true){
								if(isset($obj->pag_type) && $obj->pag_type!=8){
									echo"<th width=\"5%\">Ред.</th>";
								}
							?>
								<th width="5%">Наст.</th>
							<?php } if($access['allow_delete'] == true){ ?>
								<th width="5%">Видалити</th>
							<?php } if(isset($obj->pag_type) && $obj->pag_type!=8){
								if($access['allow_off'] == true){ ?>
								<th width="5%" nowrap="nowrap">Відображення</th>
							<?php } ?>
								<th width="8%" nowrap="nowrap">Порядок</th>
							<?php } ?>
								<th width="1%" nowrap="nowrap">Пункт ID</th>
						</tr>
					</thead>
					<tfoot>
						<tr>
							<td colspan="12">
    <div class="pagination">
	<?php echo $obj->pager['pager']; ?>
    </div>
				<div class="pagecounter"></div>
				<input type="hidden" name="limitstart" value="0" /></td>
						</tr>
					</tfoot>
					<tbody>
						<!-- CONTENT -->
						<?php $i=1; foreach($obj->result as $value){ ?>
						<tr class="row<?=$i?>" id='row<?=$value['id']?>'>
							<td><?=$i?></td>
							<td width="15px" align="left">
								<input type="checkbox" id="checkme<?=$i?>" name="cid[]" value="<?=$value['id']?>"/>
							</td>
					<?php if(isset($obj->pag_type) && $obj->pag_type==8){ ?>
							<td>
								<span class="editlinktip hasTip" title="<?php echo $value['title']; ?>">
								<?php echo $value['title']; ?>
								</span>
                             <td nowrap="nowrap" align="center" width="150px">
								<img src="/public/upload/gallery/<?php echo $value['prev']; ?>" border="0" width="150px" />
							</td>
                  <?php }else{ ?>
							<td>
								<span class="editlinktip hasTip" title="Клікніть для перегляду внутрішніх сторінок::<?=$value['title']?>">
								<a href="<?="/admin/razdel.html?id=".$value['id']?>"><?=$value['title']?></a></span>
							</td>
                            <td nowrap="nowrap" align="center" width="50px">
                   <?php if($value['type']==1){echo"Інформаційна";}elseif($value['type']==2){echo"Каталог";}elseif($value['type']==3){echo"Категорія рецептів";}elseif($value['type']==4){echo"Рецепт";}elseif($value['type']==5){echo"Контакти";}elseif($value['type']==8){echo"Фотоальбом";} ?>
                            </td>
							<td>
								<a style='padding-left:5px;' href="#" onclick="SwhowBox('<?=BASE_URL.$value['url']?>','Посилання');"><img src="/public/images/admin/icons/btn_file_bottom_link.gif" border="0" width="22px" height="15px"></a>
							</td>
                   <?php if($access['allow_edit'] == true){
							if(isset($obj->pag_type) && $obj->pag_type!=8){
					?>
							<td>
								<a style='padding-left:5px;' href="/admin/edit.html?id=<?=$value['id']?>"><img src="/public/images/edit.png" border="0" width="16px" height="16px"></a>
							</td>
					<?php } ?>
							<td>
								<a style='padding-left:5px;' href="/admin/setup.html?id=<?=$value['id']?>"><img src="/public/images/gear.png" border="0" width="16px" height="16px"></a>
							</td>
                   <?php } if($access['allow_delete'] == true){
					   if(isset($obj->pag_type) && $obj->pag_type!=8){
					?>
							<td>
								<span style='padding-left:5px;cursor:pointer;' id='del<?=$value['id']?>' onclick="actions(<?=$value['id']?>,'del');"><img src="/public/images/delete.jpg"  border="0" width="16px" height="16px"></span>
							</td>
                   <?php }else{
					?>
							<td>
								<span style='padding-left:5px;cursor:pointer;' id='del<?=$value['id']?>' onclick="actions(<?=$value['id']?>,'del_photo');"><img src="/public/images/admin/icons/error.png"  border="0" width="16px" height="16px"></span>
							</td>
					<?php
						}}
				   if(isset($obj->pag_type) && $obj->pag_type!=8){
                    if($access['allow_off'] == true){ ?>
							<td align="center">
								<?php if($value['published']!=1){ ?>
									<span style='cursor:pointer;' id='pub<?=$value['id']?>' onclick="actions(<?=$value['id']?>,'pub');" title="Публіковати">
									<img src="/public/images/admin/tick.png" border="0" alt="Опубликовано" /></span>
								<?php }else{ ?>
									<span style='cursor:pointer;' id='unpub<?=$value['id']?>' onclick="actions(<?=$value['id']?>,'unpub');" title="Відмінити публикацію">
									<img src="/public/images/admin/publish_x.png" border="0" alt="Неопубликовано" /></span>
								<?php } ?>
							</td>
                   <?php } ?>
							<td class="order" nowrap="nowrap">
                                <span><img src="/public/images/admin/downarrow.png" width="16" height="16" border="0" alt="Move Down" onclick="actions(<?=$value['id']?>,'order');" style='cursor:pointer;'/></span>
                                <input type="text" name="order" id='order<?=$value['id']?>' size="5" value="<?=$value['sort']?>" title='<?=$value['sort']?>'  class="text_area" style="text-align: center;width:30px;" />
							</td>
                    <?php } } ?>
							<td align="center"><?=$value['id']?></td>
						</tr>
						<?php $i++;} ?>
						<!-- END CONTENT -->
					</tbody>
					</table>
				</form>
				<div class="clear"></div>
			</div>
</div>
<div id="result"></div>
<?php }else{
echo"<div align='center'>
<img src='/public/images/admin/access_denied.png' border='0' width='256px' height='256px' /><br>
<span style='padding-left:10px;'><font size='5px' color='red'>
<stong>Доступ заборонено!</stong>
</font>
<br>
У вас недостатньо повноважень для доступу до розділів!
</span>
</div>";
} ?>
